{*
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 *}	

{$html->toolbar->title('##Forums##')}
{$html->toolbar->apply('apply_forum')}
{$html->toolbar->save('save_forum')}
{$html->toolbar->cancel()}

{$html->toolbar->divider()}

{if $forum.forum_id}
	{* deleteList parameters - $msg - confirmation message, $task - task to do, $alt - message *}
	{$html->toolbar->deleteList('','delete_groups','Delete groups')}
	{$html->toolbar->popup('add_group','Add group','new',500,300,'forum_id',$forum.id)}
{/if}
<form name="adminForm" method="POST">
	{$html->form->param('option','com_agora')}
	{$html->form->param('agora_task','forums')}
	{$html->form->param('task','forums')}

	{if isset($forum.id) && $forum.id > 0}
		{$html->form->param('form[forum_id]',$forum.forum_id)}
	{/if}

	<div class="col width-45">
	<fieldset>
		<legend>##Forum parameters##</legend>

		<table class="admintable">
			<tbody>
				<tr>
					{adminform->text var='forum_name' caption='Forum name' value=$forum.forum_name}
					{adminform->radio var='enable' caption='Enabled' desc='Dissabled Forums are not shown on Index pages' value=$forum.enable}
                    {adminform->radio var='use_moderation' caption='Use moderation' desc='When moderation is turned On, new posts will be held for approval by administrators and/or moderators' value=$forum.use_moderation}
                    {adminform->radio var='closed' caption='Closed' desc='Closed Forums can be viewed, but topics are closed' value=$forum.closed}
                    {adminform->text var='closed_text' caption='Closed Note' desc='Short Note explaining why Forum is closed' value=$forum.closed_text}
                    {adminform->radio warn=true var='single_topic' caption='Single Topic Forum' desc='This will Limit Users to only ONE new Topic in this forum. Please be sure you know what you are doing' value=$forum.single_topic}
					{adminform->textarea var='forum_desc' caption='Description' desc='Forum description' value=$forum.forum_desc}
					{adminform->textarea var='forum_mdesc' caption='Meta description' desc='Forum META description' value=$forum.forum_mdesc}
					{adminform->text var='forum_key' caption='Forum keywords' value=$forum.forum_key}
					{adminform->select selected=$forum.parent_object_id style='width: 200px;' size=5 var='parent_object' caption='Parent object' desc='Select parent object' keys=$parents}
					{adminform->select style='width: 200px;' var='icon_style_id' caption='Style' desc='Style_2' keys=$styling selected=$forum.icon_style_id}
					
					{adminform->radio var='forum_type' caption='Support Mode' desc='Turn on support mode?' value=$forum.forum_type}
				</tr>
			</tbody>
		</table>
	</fieldset>
    	<fieldset>
		<legend>##Scheduling##</legend>

		<table class="admintable">
			<tbody>
				<tr><td>
                    {adminform->radio warn=true var='enable_sched' caption='Enable Scheduling' desc='Automatically close the forum on a set date. Please be sure you know what you are doing' value=$forum.enable_sched}
                 	{adminform->curentSiteTime  caption='Current Site Date/Time' }
                    {adminform->calendar var='sched_end' caption='Expire Date/Time' value=$forum.sched_end}
				</td></tr>
			</tbody>
		</table>
	</fieldset>
	</div>
	<div class="col width-55">
		<fieldset>
			<input type="hidden" name="checked" value="0"/>
			<input type="hidden" name="boxchecked" value="0"/>

			<legend>##Groups##</legend>
			<table class="adminlist">
				<thead>
					<th width="20">
						<input type="checkbox" name="toggle" value="" onclick="checkAll({$groups|@count});" />
					</th>
					<th width="250px">##group name##</th>
					<th>##access levels##</th>
				</thead>
				<tbody>
					{foreach name=groups from=$groups item=group}
					<tr>
						<td>{$html->jhtml('grid.id', $smarty.foreach.groups.index, $group.id)}</td>
						<td colspan="2"><strong>{$html->form->treename($group)}</strong></td>
					</tr>
						{foreach from=$group.permissions key=role item=permissions}
						<tr>
							<td></td>
							<td>
								{$roles.$role}
							</td>
							<td>
								<a href="{url task=forums action=edit_permissions type=clean forum_id=$forum.id group_id=$group.id role_id=$role}"
								class="modal hasTip"
								title="Forum permissions for '{$group.name}'/{$roles.$role}::{$permissions|@implode:'<br/>'}"
								rel="{literal}{handler: 'iframe', size: {x: 500, y: 400}}{/literal}"
								>
								{if empty($permissions)}
									<i>##No access##</i>
								{else}
									{$permissions|@implode:', '|truncate:50}
								{/if}
								</a>
							</td>
						</tr>
						{/foreach}
					{foreachelse}
						{if !$forum.id}
							<tr><td colspan="3">##Please save (or apply) forum first##</td></tr>
						{else}
							<tr><td colspan="3">##No groups defined##</td></tr>
						{/if}
					{/foreach}
				</tbody>
			</table>
		</fieldset>
		
		
		<fieldset>
		<legend>##Questions##</legend> 
		
		
		<table class="admintable">
			<tbody>
			{adminform->radio var='questenable' caption='Enabled' desc='Dissabled questions in topics of forum' value=$questenable}
				<tr>
					<td class="key">##Kit##</td>
					<td>
						<select name="form[quest_group]" size="10" style="width: 300px">
							{foreach from=$knames item=kname}
							<option value="{$kname}" {if $kname==$old_kitname} selected {/if} >{$kname}</option>
							{foreachelse}
							<option disabled="disabled">##No kits left##</option>
							{/foreach}
						</select>
					</td>
				</tr>
				
			</tbody>
		</table>
		</fieldset>
		
	</div>
</form>